home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / newmat08.zip / SL_EX.CPP < prev    next >
C/C++ Source or Header  |  1995-01-19  |  615b  |  29 lines

  1. // This is an example of the use of solution to find the cube root of 
  2. // the integers -10 to 10
  3.  
  4. // you will need to compile and link solution.cpp and except.cpp
  5.  
  6. #define WANT_STREAM
  7. #define WANT_MATH
  8.  
  9. #include "include.h"
  10. #include "solution.h"
  11.  
  12. // the cube class
  13.  
  14. class Cube : public R1_R1
  15. { Real operator()() { return x*x*x; } };
  16.  
  17. main()
  18. {
  19.    // construct the Cube object
  20.    Cube cube;
  21.    // and then the solve object
  22.    OneDimSolve cube_root(cube);
  23.    // Now do the solves
  24.    for (int i=-10; i<=10; i++)
  25.       cout << i << "   "  << cube_root.Solve(i,0,1.5) << endl;
  26.    return 0;
  27. }
  28.  
  29.